<template>
  <div>
    <hi>父亲</hi>
    <p>{{message}}</p>
     <!-- props 属性值传递和方法函数   -->
    <Child :message="message" :list="list"  @addFromChild="addFromChild"></Child>
  </div>
</template>

<script>
import Child from "./Child";

let data = {
  list:  ['a','b'],
  message:'hello vue'
}

export default {
  name: "Parent",
  components: {Child},
  data() {
    return data
  },
  methods:{
    addFromChild: function (title) {
      console.log(title)
      this.message = title
      this.list.push(title)
      this.$children[0].number =  20
      console.log(this.$children[0].number)
    }
  },
  created() {
    console.log('Parent:  created')
  },
  mounted() {
    console.log('Parent:  mounted')
  },
  beforeUpdate() {
    console.log('Parent:  beforeUpdate')
  },
  updated() {
     console.log('Parent:   updated')
  },
  beforeDestroy() {
     console.log('Parent:  beforeDestroy')
  }
}
</script>

<style scoped>

</style>
